<extend name='Index/index' />

<block name="main">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">用户组</h1>
    </div>
    <div class="wrapper-md">
        <div class="panel panel-default">
            <div class="table-responsive">
                <table class="table table-striped b-t b-light">
                    <thead>
                        <tr>
                            <th  width="14%"><div align='center'>ID</div></th>
                            <th  width="23%"><div align='center'>角色/组</div></th>
                            <th  width="10%"><div align='center'>状态</div></th>
                            <th  width="34%"><div align='center'>创建时间</div></th>
                            <th  width="30%"><div align='center'>操作</div></th>
                        </tr>
                    </thead>
                    <tbody>
                        <foreach name="data" item="vo" key='k'>
                            <tr>
                                <td align='center'><{$vo.id}></td>
                                <td align='center'><{$vo.title}></td>
                                <td align='center'>
                                <if condition="$vo.status"><a href="">开启</a>
                                <else/><a>禁用</a>
                                </if>
                                </td>
                                <td align='center'><{$vo.create_time|date="Y-m-d H:i:s",###}></td>
                                <td align='center'>
                                <if condition="in_array('Admin/groupp_edit',$access)">
                                <a href="<{:U('Admin/group_edit',array('id'=>$vo['id']))}>"  class="disabled btn" >授权 / 编辑</a>
                                <else/>
                                <a href="<{:U('Admin/group_edit',array('id'=>$vo['id']))}>" class="btn btn-default" >授权 / 编辑</a>
                                </if>
                                <if condition="in_array('Admin/group_del',$access)">
                                  <a href="" class="disabled btn">删除</a>
                                <else/>
                                  <a href="" class="btn btn-default" >删除</a>
                                </if>
                                </td>
                            </tr>
                        </foreach>
                    </tbody>
                </table>
            </div>
        </div>
        <{$page}>
        <p></p>
        <p></p>
    </div>
<script>
    $("a:contains('删除')").click(function(){
            if (confirm('确认删除?')) {
                var id = $(this).parent().siblings().eq(0).html();
                var tr = $(this).parents('tr');
                $.ajax({
                    url: "<{:U('Admin/group_del')}>",
                    data:{'id':id},
                    type: 'get',
                    success: function(data){
                        alert(data);
                        if (data == "删除成功") {
                            tr.remove();
                        }
                    }
                })
            }
        })
</script>

</block>